/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package networkrespnse;

import core.ParameterDecoder;
import utils.Utils;
/**
 *
 * @author Kvest
 */
public class DriverParkingPositionResponse extends Response
{
    private int registeredOnParking;
    private int uid;
    private int position;

    public DriverParkingPositionResponse(byte[] data)
    {
        super(DRIVER_PARKING_POSITION_RESPONSE);
        registeredOnParking = 0;
        uid = -1;
        position = -1;
        
        parse(data);
    }

    protected void parse(byte[] data)
    {
        byte[] body,temp;
	int index;

        //��������  body
        body = ParameterDecoder.getTransferBody(data);
        //������������� ��������
        temp = new byte[4];
        index = 0;
        for (int i=0;i<4;i++)
        {
                temp[i] = body[index++];
        }
        index += Utils.byteToInt(temp);
        //������ ��������
        temp[0] = body[index++];
        temp[1] = 0;
        temp[2] = 0;
        temp[3] = 0;
        registeredOnParking = Utils.byteToInt(temp);
        
        //UID
        for (int i=0;i<4;i++)
        {
                temp[i] = body[index++];
        }
        uid = Utils.byteToInt(temp);
        //Position
        for (int i=0;i<4;i++)
        {
                temp[i] = body[index++];
        }
        position = Utils.byteToInt(temp);
    }

    public int getRegisteredOnParking()
    {
        return registeredOnParking;
    }

    public int getUID()
    {
        return uid;
    }

    public int getPosition()
    {
        return position;
    }
}
